import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/data-quality/businessModel/pageList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}


export const getTableNames = (id) => {
  return request({
    url: '/api/data-quality/businessModel/getTableNames',
    method: 'get',
    params: {
      id,
    }
  })
}

export const getTableStructure = (id, tableName) => {
  return request({
    url: '/api/data-quality/businessModel/getTableStructure',
    method: 'get',
    params: {
      id, tableName
    }
  })
}

export const saveBusinessModelInfo = (row) => {
  return request({
    url: '/api/data-quality/businessModel/saveBusinessModelInfo',
    method: 'post',
    data: row
  })
}

export const modelDetail = (id) => {
  return request({
    url: '/api/data-quality/businessModel/modelDetail',
    method: 'get',
    params: {
      id
    }
  })
}

export const updateModelInfo = (row) => {
  return request({
    url: '/api/data-quality/businessModel/updateModelInfo',
    method: 'post',
    data: row
  })
}

export const deleteModelInfos = (ids) => {
  return request({
    url: '/api/data-quality/businessModel/deleteModelInfos',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const deleteOneModelInfo = (id) => {
  return request({
    url: '/api/data-quality/businessModel/deleteOneModelInfo',
    method: 'post',
    params: {
      id,
    }
  })
}

export const getThemeInfosByTables = (params) => {
  return request({
    url: '/api/data-quality/businessModel/getThemeInfosByTables',
    method: 'get',
    params: {
      ...params,
    }
  })
}
export const getModelThemeTree = () => {
  return request({
    url: '/api/data-quality/businessModel/getModelThemeTree',
    method: 'get',
  })
}

export const getDataBaseType = (modelId) => {
  return request({
    url: '/api/data-quality/businessModel/getDataBaseType',
    method: 'get',
    params: {
      modelId
    }
  })
}

export const modelList = () => {
  return request({
    url: '/api/data-quality/businessModel/getListInfo',
    method: 'get',
  })
}

export const getThemeRuleTree = (modelId) => {
  return request({
    url: '/api/data-quality/businessModel/getThemeRuleTree',
    method: 'get',
    params: {
      modelId
    }
  })
}

export const getStatisticalType = (modelId) => {
  return request({
    url: '/api/data-quality/businessModel/getStatisticalType',
    method: 'get',
    params: {
      modelId
    }
  })
}
